package com.share.example.stock.web;

import com.share.common.common.Page;
import com.share.common.common.Result;
import com.share.common.utils.DateUtil;
import com.share.example.stock.model.vo.StrategyPageReq;
import com.share.example.stock.service.ITradeDateService;
import com.share.example.stock.service.StrategyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/strategy")
public class StrategyController {
    @Autowired
    private ITradeDateService iTradeDateService;
    @Autowired
    private StrategyService strategyService;

    //分页
    @RequestMapping("/pageList")
    public Result pageList(StrategyPageReq req) {
        Page page = strategyService.pageList(req);
        return Result.success(page);
    }

    //执行十字星策略
    @RequestMapping("/callShizixin")
    public Result callShizixin(String date) {
        if (StringUtils.isBlank(date)) {
            date = DateUtil.getDate();
        }
        return Result.success(strategyService.shizixin(date));
    }

    @RequestMapping("/checkName")
    public Result checkName() {
        return Result.success(strategyService.checkName());
    }
}
